// WARNING: This file has been generated. Any manual changes must be made within preserved regions or they will be lost.

//===============================================================================
//
// StoredProcedureParameterCollection
//
// PURPOSE: 
// 
//
// NOTES: 
// 
//
//===============================================================================
//
// Copyright (C) 2003 Wallis Software Solutions
// All rights reserved.
//
// THIS CODE AND INFORMATION IS PROVIDED 'AS IS' WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR
// FITNESS FOR A PARTICULAR PURPOSE.
//
//===============================================================================

namespace Agile.Genie.Descriptors
{

    using Agile.Common;
        /// <summary>
        /// StoredProcedureParameterCollection
        /// </summary>
    public class StoredProcedureParameterCollection : AgileCollection
    {

        #region Preserved Region - Developer Hand Written Code

        /// <summary>
        /// Checks if the an parameter in the collection has the given name.
        /// </summary>
        /// <param name="columnName">Name of the parameter to find in the collection.</param>
        /// <returns>True if an item in the collection has the given name.</returns>
        public bool ContainsParameterNamed(string columnName)
        {
            foreach(StoredProcedureParameter parameter in this)
            {
                if(parameter.ColumnName.Equals(columnName))
                    return true;
            }
            return false;
        }

        #endregion // Preserved Region - Developer Hand Written Code

        #region Constructors and Factories

        /// <summary>
        /// Constructor
        /// </summary>
        internal StoredProcedureParameterCollection()
        {
        }

        /// <summary>
        /// Instantiate a new StoredProcedureParameterCollection
        /// </summary>
        public static StoredProcedureParameterCollection Instantiate()
        {
            return new StoredProcedureParameterCollection();
        }

        #endregion

        #region Strongly Typed IList Implementations

        /// <summary>
        /// Add a new StoredProcedureParameter to the collection
        /// </summary>
        /// <param name="storedProcedureParameter">storedProcedureParameter to add to the collection.</param>
        public void Add(StoredProcedureParameter storedProcedureParameter)
        {
            if (this.Contains(storedProcedureParameter))
            {
                string message = string.Format("Tried adding a StoredProcedureParameter to the collection but it is already in it.");
                throw new DescriptorsException(message);
            }
            List.Add(storedProcedureParameter);
        }
        /// <summary>
        /// Remove a StoredProcedureParameter from the collection
        /// </summary>
        /// <param name="storedProcedureParameter">storedProcedureParameter to remove from the collection.</param>
        public void Remove(StoredProcedureParameter storedProcedureParameter)
        {
            base.Remove(storedProcedureParameter);
        }
        /// <summary>
        /// Checks if the given StoredProcedureParameter is in the collection
        /// </summary>
        /// <param name="storedProcedureParameter">storedProcedureParameter to look for in the collection.</param>
        /// <returns>True if the item is in the collection.</returns>
        public bool Contains(StoredProcedureParameter storedProcedureParameter)
        {
            return base.Contains(storedProcedureParameter);
        }


        /// <summary>
        /// Searches for the specified StoredProcedureParameter and returns the zero-based index
        /// of the first occurrence within the section of the
        /// collection that starts at the
        /// specified index and contains the specified number of elements.
        /// </summary>
        /// <param name="storedProcedureParameter">storedProcedureParameter to get the index of from the collection.</param>
        /// <returns>The index of the item in the collection.</returns>
        public int IndexOf(StoredProcedureParameter storedProcedureParameter)
        {
            return base.InnerList.IndexOf(storedProcedureParameter);
        }

        /// <summary>
        /// Searches for the specified StoredProcedureParameter and returns the zero-based index
        /// of the first occurrence within the section of the
        /// collection that starts at the
        /// specified index and contains the specified number of elements.
        /// </summary>
        /// <param name="storedProcedureParameter">storedProcedureParameter to get the index of from the collection.</param>
        /// <param name="startIndex">The zero-based starting index of the search.</param>
        /// <returns>The index of the item in the collection.</returns>
        public int IndexOf(StoredProcedureParameter storedProcedureParameter, int startIndex)
        {
            return base.InnerList.IndexOf(storedProcedureParameter, startIndex);
        }

        /// <summary>
        /// Searches for the specified StoredProcedureParameter and returns the zero-based index
        /// of the first occurrence within the section of the
        /// collection that starts at the
        /// specified index and contains the specified number of elements.
        /// </summary>
        /// <param name="storedProcedureParameter">storedProcedureParameter to get the index of from the collection.</param>
        /// <param name="startIndex">The zero-based starting index of the search.</param>
        /// <param name="count">The number of elements in the section to search.</param>
        /// <returns>The index of the item in the collection.</returns>
        public int IndexOf(StoredProcedureParameter storedProcedureParameter, int startIndex, int count)
        {
            return base.InnerList.IndexOf(storedProcedureParameter, startIndex, count);
        }

        /// <summary>
        /// Inserts the StoredProcedureParameter into the collection at the specified index.
        /// </summary>
        /// <param name="index">The zero-based index at which value should be inserted.</param>
        /// <param name="storedProcedureParameter">storedProcedureParameter to insert into the collection.</param>
        public void Insert(int index, StoredProcedureParameter storedProcedureParameter)
        {
            base.InnerList.Insert(index, storedProcedureParameter);
        }
        /// <summary>
        /// Returns the StoredProcedureParameter that is at the given index in the collection.
        /// </summary>
        public StoredProcedureParameter this[int index]
        {
            get { return InnerList[index] as StoredProcedureParameter; }
        }
        /// <summary>
        /// Copies a range of elements from the collection of StoredProcedureParameter's to a compatible
        /// one-dimensional System.Array, starting at the specified index of the target array.
        /// </summary>
        /// <param name="storedProcedureParameters">The one-dimensional System.Array that is the destination of the elements copied from the collection. The System.Array must have zero-based indexing.</param>
        /// <param name="index">The zero-based index at which copying begins.</param>
        public void CopyTo(StoredProcedureParameter[] storedProcedureParameters, int index)
        {
            List.CopyTo(storedProcedureParameters, index);
        }
        #endregion

    }

}
